package com.tongshu.naive.chat.socket.handler;

import com.tongshu.naive.chat.application.UIService;
import com.tongshu.naive.chat.socket.MyBizHandler;
import com.tongshu.naive.chat.ui.view.chat.IChatMethod;
import io.netty.channel.Channel;
import javafx.application.Platform;
import protocol.friend.AddFriendRequest;
import protocol.friend.AddFriendResponse;

public class AddFriendHandler extends MyBizHandler<AddFriendResponse> {
    public AddFriendHandler(UIService uiService) {
        super(uiService);
    }

    @Override
    public void channelRead(Channel channel, AddFriendResponse msg) {
        IChatMethod chatMethod = uiService.getiChatMethod();
        Platform.runLater(()->{
            chatMethod.addFriendUser(true, msg.getFriendId(), msg.getFriendNickName(), msg.getFriendHead());
        });
    }
}
